import request from '@/utils/request'
export function fetchList(params) {
  return request({
    url:'/role/list',
    method:'get',
  })
}



// GET /role/checkPermission/{roleId


export function permissionUp(roleId,data) {
  return request({
    url:'/role/permission/update?roleId=' + roleId + '&permissionIds=' + data,
    method:'post',
    data:data
  })
}

export function rolePermission(id) {
  return request({
    url:'/role/permission/'+id,
    method:'get'
  })
}
export function createRole(data) {
  return request({
    url:'/role/create',
    method:'post',
    data:data
  })
}

export function updateShowStatus(data) {
  return request({
    url:'/role/update/showStatus',
    method:'post',
    data:data
  })
}

export function updateFactoryStatus(data) {
  return request({
    url:'/role/update/factoryStatus',
    method:'post',
    data:data
  })
}

export function deleteRole(data) {
  let dataList = data.join(',')
  return request({
    url:'/role/delete?ids=' + dataList,
    method:'post',
  })
}


// export function deleteUser(data) {
//   let dataList = data.join(',')
//   return request({
//     url:'/role/delete?ids=' + dataList,
//     method:'post'
//   })
// }

export function getRole(id) {
  return request({
    url:'/role/'+id,
    method:'get',
  })
}

export function updateRole(id,data) {
  return request({
    url:'/role/update/'+id,
    method:'post',
    data:data
  })
}

